Functions > di_digout

Syntax 

di_digout is an immediate function that writes (outputs) a 16 bit value to the digital output port. Values and locations are device dependent.

Syntax 

unsigned di_digout(i);

unsigned i;

/* value to output to the digital out port */

Parameters

i is the 16-bit value to send to the digital out port. Values and locations are device dependent.

Return Value

DI_NO_ERR No error
DI_OPENED_ERR Device not opened
DI_COMM_ERR Communication error
DI_DIGOUT_ERR Digital output error

Dependencies

di_open

Remarks

The default state of the digital output bits is “High.” Values and locations of the digital input bits are device dependent.

DI-148, DI-149*, DI-158, DI-700, DI-71x, DI-220, DI-400
DI-1110, DI-1120, DI-2008, DI-2108, DI-2108-P, DI-4108, DI-4208, DI-4718B
DI-720, DI-5001, DI-500, DI-78x Printer Port and Ethernet Devices
DI-720 USB Devices using the USB Port
DI-720 USB Devices using the Printer Port

Sample Code

#include "200sdk.h"

char errstr[255];

int i;

main()

{

if(errcode = di_open()){

/* open the device for comm */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Device installed successfully.....\n");

i = 5;

if(errcode = di_digout(i)){

/* output i to digital output port */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Digital output successful.....\n");

di_close();

}

 

Copyright © DATAQ Instruments, Inc.